var numListActiveView = 0;
var numListTerapeuticView = 0;


$(document).ready(function() {
    
	
	$("#loginForm").submit(function () {
		$.mobile.changePage( "initPage.html");	
			
	});

	
	  var group = {};
	  var textGroup = ['PrimerTexto', 'SegundoTexto', 'TercerTexto'];
	  var wheels = [group];
	 // for (var i = 1; i < 4; i++) {
		  var wheel = {};
		  for (var j = 0; j < 3; j++) {
			  wheel[j] = textGroup[j]
		  }
		  group['Seleccion ' + 1] = wheel;
	 // }

	  $('#custom').scroller({
		  wheels: wheels
	  });
	  
	 
	  
	  // Display a custom filter for a movie search (see Figure 4–22). 
	  $( "#element2" ).scroller({
		setText: 'Search', 
		theme: 'sense-ui',
		preset: 'stringFormat',  
	  	wheels: wheels, 
		wheelArray:textGroup
	  });	
	
	
	$("#terapeuticaList").click(function(){
		var newList = $( '<ul data-role="listview" data-theme="d" data-inset="true" data-filter="true" data-filter-placeholder="Búsqueda..." id="terapeuticaList"><li data-role="list-divider"> A </li><li><a href="#">Alprazolam</a></li><li><a href="#">Amisulprida</a></li><li><a href="#">Amozapina</a></li><li><a href="#">Anfetamina (d)</a></li><li><a href="#">Aripiprazol</a></li><li data-role="list-divider"> B </li><li><a href="#">Buprioprion</a></li><li><a href="#">Buspirona</a></li><li data-role="list-divider"> C </li></ul>' );
		var wherePutList = "#" + $(this).attr("id") + "Content";
		if (numListActiveView == 0)
			$().createDynamicList(newList,wherePutList);
		numListActiveView=1;
	});
	
	
	
	
});




jQuery.fn.createDynamicList = function(List, position) {
   List.insertAfter( position ).listview();
};